<template>
  <div>
    <el-form label-width="120px" size="mini" class="form-view">
      <div id="module2">
        <div class="anthor-info-body">
          <PageableTable
            :columns="insideColumns"
            :loading="false"
            :table-height="240"
            :data="formItem.details"
            :disable-pageable="true"
            class="fixed-table-table"
          >
            <el-table-column
              label="序号"
              type="index"
              width="50"
            />
            <el-table-column v-for="column in insideColumns" :key="column.key" :label="column.title" :prop="column.key" :sortable="column.sortable">
              <template slot-scope="scope">
                <column-render :render="column.render" :row="scope.row" :column="column" />
              </template>
            </el-table-column>
          </PageableTable>
        </div>
      </div>
    </el-form>
  </div>
</template>
<script>
import { confirmDetail as detail } from '@neu/dcam-ui/api/baofeiKJ'
import PageableTable from '@neu/biz-core/components/PageableTable'
const formItem = {
  title: '', // 工单标题
  remark: '',
  workOrderNum: '',
  taskId: '',
  disposeDate: null,
  reason: '',
  comprehensive: true,
  details: []
}
export default {
  components: {
    PageableTable
  },
  props: {
    taskId: {
      required: false,
      type: String,
      default: 'NULL'
    },
    workOrderNum: {
      required: false,
      type: String,
      default: ''
    }
  },
  data() {
    return {
      // 编辑的表单内容
      formItem: {
        ...formItem
      },
      insideColumns: [
        { title: '资产名称', width: 100, key: 'name' },
        { title: '资产编号', width: 120, key: 'code' },
        { title: '大分类', width: 100, key: 'bigTypeName' },
        { title: '中分类', width: 100, key: 'middleTypeName' },
        { title: '小分类', width: 100, key: 'smallTypeName' },
        { title: '规格型号', width: 100, key: 'specifications' },
        { title: '序列号', width: 100, key: 'serialnumber' },
        { title: '使用人', width: 100, key: 'managementUserName' }
      ]
    }
  },
  created() {
    this.fetch()
  },
  methods: {
    fetch() {
      if (this.workOrderNum !== 'NULL') {
        detail(this.workOrderNum, this.taskId).then(response => {
          this.formItem = {
            ...response.data
          }
        })
      }
    }
  }
}
</script>
